import React from 'react'
import './index.scss'
import  {menuList} from '../data.js'
import { Link } from "react-router-dom";
import { Layout, Menu } from "antd";
const {  Content,Sider } = Layout;
const Left =()=> {


  // 获取菜单展示数据结构
  const getMenuItems = (menu) => {

      if(!menu)  return [];
      const menuConfig = [];
      menu.forEach((item) => {
          if(item.resourceType === 'menu') {
            const obj = {
              key: item.id,
              label: item.resourceUrl ? (
                <Link to = {item.resourceUrl} key={item.id} >
                   {item.resourceName}
                </Link>
              ): (item.resourceName)
           }
           
            menuConfig.push(obj);
          }
      });
      return menuConfig;
  }
  return (
    <Layout  className='content-left'>
        <Sider className='sider'>
           <Menu
              mode="inline"
              className='menu'
              items={getMenuItems(menuList)}
           />
        </Sider>
        {/* <Sider className='sider'>
           <Menu
              mode="inline"
              className='menu'
              items={getMenuItems(menuList)}
           />
        </Sider> */}
        <Content>
            
        </Content>
    </Layout>
  )
}
export default Left;